import grpc

from app.aichat.pb import aichat_pb2, aichat_pb2_grpc


def run():
    with grpc.insecure_channel('localhost:8080') as channel:
        stub = aichat_pb2_grpc.aichatStub(channel)
        for response in stub.ChatStream(aichat_pb2.UserMsg(content='我能够娶到心仪的对象吗？')):
            print("收到响应:", response.chunk)

if __name__ == '__main__':
    run()
